check if a date time string is a valid date in js

53

check if a date time string is a valid date in js -

const isValidDate = function(date) {
    return (new Date(date) !== "Invalid Date") && !isNaN(new Date(date));
}

Comments

Submit
0 Comments